<?php

namespace App\Models\Admin\Stats\Platform\Settlement;

use App\Models\Admin\Model;
use App\Models\Game\Platform\Org;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class Month extends Model
{

    /**
     * 数据表名称
     *
     * @var string
     */
    protected $table = 'stats_platform_settlement_months';

    /**
     * 不可批量赋值的字段
     *
     * @var array
     */
    protected $guarded = [];

    /**
     * 进行类型转换的字段
     *
     * @var array
     */
    protected $casts = [
        'usd' => 'array',
        'rates' => 'array',
    ];

    /**
     * 获得平台信息
     *
     * @return BelongsTo
     */
    public function org(): BelongsTo
    {
        return $this->belongsTo(Org::class, 'plat_code', 'code')->withTrashed();
    }
}
